<template>
	<view class="main">
		<header-vue :back="true" title="领券中心">
			<template #btnLt>
				<view v-if="orderIndex" class="flex center manage-btn font24" @click="isManage = !isManage">
					<i class="iconfont icon-cart-manage font24"></i>
					{{!isManage ? '管理' : '退出管理'}}
				</view>
			</template>
		</header-vue>
		<view class="flex order-type select-box font30">
			<view class="item" v-for="(item, index) in orderType" :class="{active: orderIndex == index}"
				@click="orderIndex = index">{{item}}</view>
		</view>
		<view v-if="orderIndex" class="flex between font28 tab">
			<view v-for="(item, index) in typeList" class="flex column" :class="{active: typeIndex == index}"
				@click="typeIndex = index">
				<view>{{item.name}}</view>
				<i class="iconfont icon-tab-circle"></i>
			</view>
		</view>
		<view class="flex center" v-for="item in 10" style="margin: 28rpx 32rpx;">
			<view v-if="isManage && orderIndex" class="flex between font28" style="margin-right: 28rpx;" :class="{active: item.radio}"
				@click="item.radio = !item.radio">
				<view class="flex radio">
					<i class="iconfont icon-duihao" v-if="item.radio"></i>
				</view>
			</view>
			<view v-if="typeIndex == 1" class="flex list-item">
				<view class="flex center column item-left">
					<view class="price"><text class="font48">¥</text>99</view>
					<view class="font24">满99减</view>
				</view>
				<view class="flex between" style="flex: 1;padding: 0 28rpx 0 20rpx;box-sizing: border-box;">
					<view>
						<view class="font30 fontbold-500">服务券</view>
						<view class="time">2025-03-10 16:49:42 到期</view>
						<view class="font24" style="color: #999;">限家政服务类订单使用</view>
					</view>
					<image :src="IMAGE_URL + '/static/mine/used.png'"></image>
				</view>
			</view>
			<view v-else-if="typeIndex == 2" class="flex list-item" style="color: #999;">
				<view class="flex center column item-left" style="background: rgba(255,255,255,0.5);">
					<view class="price" style="color: #666666;"><text class="font48">¥</text>99</view>
					<view class="font24">满99减</view>
				</view>
				<view class="flex between" style="flex: 1;padding: 0 28rpx 0 20rpx;box-sizing: border-box;">
					<view>
						<view class="font30 fontbold-500" style="color: #666666;">服务券</view>
						<view class="time">2025-03-10 16:49:42 到期</view>
						<view class="font24">限家政服务类订单使用</view>
					</view>
					<image :src="IMAGE_URL + '/static/mine/expire.png'"></image>
				</view>
			</view>
			<view v-else class="flex list-item">
				<view class="flex center column item-left">
					<view class="price"><text class="font48">¥</text>99</view>
					<view class="font24">满99减</view>
				</view>
				<view class="flex between" style="flex: 1;padding: 0 28rpx 0 20rpx;box-sizing: border-box;">
					<view>
						<view class="font30 fontbold-500" style="margin-bottom: 20rpx;">服务券</view>
						<view class="font24">限家政服务类订单使用</view>
					</view>
					<view class="flex center btn">立即领取</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import headerVue from '../../components/header.vue';
	import llqVue from './publicCom/llq.vue';
	import llxVue from './publicCom/llx.vue';
	import hdqVue from './publicCom/hdq.vue';
	import gxzVue from './publicCom/gxz.vue';
	import appConfig from '@/config/app.js'
  import {getAppDataInfo , postappdatainfo } from "@/api/modules/shop.js"
	export default {
		components: {
			headerVue,
			llqVue,
			llxVue,
			hdqVue,
			gxzVue
		},
		data() {
			return {
				IMAGE_URL: appConfig.IMAGE_URL,
				imageUrl: '~@static/shop/',
				typeIndex: 0,
				orderIndex: 0,
				orderType: ['领福利', '我的劵包'],
				typeList: [{
						name: '待使用(12)'
					},
					{
						name: '已使用(3)'
					},
					{
						name: '已过期(10)'
					}
				],
				isManage: false,
				selectShow: false,
				showFilter: false,
				params: {
					keyword: '',
					type: ''
				}
			}
		},
		onLoad() {
			
		},
		methods: {
			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		background: #F6F6F6;
	}

	.margin32 {
		margin: 0 32rpx;
	}

	.search-box {
		height: 72rpx;
		background: $uni-bg-color;
		border-radius: 60rpx;
		padding: 0 28rpx;
		margin-bottom: 28rpx;
		width: 100%;

		.iconfont {
			color: $uni-text-color-grey;
			margin-right: 20rpx;
		}

		.input {
			width: 100%;
			height: 100%;
			color: $uni-text-color-grey;
		}
	}

	.price {
		color: $uni-text-color-red;
		align-items: baseline;
		font-size: 64rpx;
	}

	.select-box {
		position: relative;
		background: $uni-bg-color;
		box-sizing: border-box;

		.select-modal {
			width: 100vw;
			position: absolute;
			z-index: 10;
			background: $uni-bg-color;
			border-radius: 0rpx 0rpx 28rpx 28rpx;
			left: -32rpx;
			top: 100%;
			margin-top: 8rpx;
			padding: 28rpx 32rpx;
			box-sizing: border-box;

			.select-modal-item {
				margin-top: 40rpx;
				color: $uni-text-color-grey1;

				&:nth-child(1) {
					margin: 0;
				}
			}

			.radio {
				width: 26rpx;
				height: 26rpx;
				border-radius: 50%;
				border: 1rpx solid $uni-color-primary;
			}

			.active {
				color: $uni-text-color;

				.radio {
					background: $uni-color-primary;
					color: $uni-text-color-inverse;
				}
			}
		}
	}

	.order-type {
		padding: 20rpx 32rpx;

		.item {
			color: $uni-text-color-grey1;
			height: 42rpx;
			position: relative;
			margin-left: 160rpx;

			&:nth-child(1) {
				margin-left: 0;
			}
		}

		.active {
			font-weight: 500;
			font-size: 32rpx;
			color: $uni-text-color;

			&:before {
				content: '';
				width: 32rpx;
				height: 6rpx;
				background: #0785CF;
				border-radius: 20rpx;
				position: absolute;
				bottom: -20rpx;
				left: 50%;
				transform: translate(-50%, 0);
			}
		}
	}

	.tab {
		color: $uni-text-color-grey1;
		margin: 28rpx 32rpx;

		.icon-tab-circle {
			width: 26rpx;
			height: 12rpx;
			margin-top: 6rpx;
			font-size: 12rpx;
			color: $uni-text-color-inverse;
		}

		.active {
			color: $uni-text-color;
			font-size: 30rpx;
			font-weight: 500;

			.icon-tab-circle {
				color: $uni-color-primary;
			}
		}
	}

	.list-item {
		height: 160rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
		border-radius: 20rpx;

		.item-left {
			width: 208rpx;
			height: 160rpx;
			background: linear-gradient(146deg, #FFF0CD 0%, #FDE4B8 100%);
			border-radius: 20rpx 0rpx 0rpx 20rpx;
		}

		.btn {
			width: 142rpx;
			height: 48rpx;
			background: linear-gradient(270deg, #FFF0CD 0%, #FDE4B8 100%);
			box-shadow: inset 0rpx 0rpx 8rpx 0rpx rgba(233, 222, 204, 0.2), 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.06);
			border-radius: 60rpx 60rpx 60rpx 60rpx;
			font-weight: 400;
			font-size: 24rpx;
			color: #EE241D;
		}
	}

	.time {
		margin: 12rpx 0;
		color: #999;
		font-size: 24rpx;
	}

	image {
		width: 100rpx;
		height: 100rpx;
	}

	.manage-btn {
		color: $uni-color-primary;
	}

	.icon-cart-manage {
		margin-right: 4rpx;
		height: 24rpx;
	}

	.radio {
		width: 26rpx;
		height: 26rpx;
		border-radius: 50%;
		border: 1rpx solid $uni-color-primary;
		margin-right: 8rpx;
	}

	.active {
		color: $uni-text-color;

		.radio {
			background: $uni-color-primary;
			color: $uni-text-color-inverse;
		}
	}
</style>